home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Patches 1998 April / IRIX 6.4 Recommended-Required Patches April 1998.img / dist / 6.4_OCTANE / patchSG0002839.idb / usr / include / sys / shm.h.z / shm.h
C/C++ Source or Header  |  1998-04-01  |  4KB  |  149 lines

  1. /**************************************************************************
  2.  *                                      *
  3.  *          Copyright (C) 1990-1996 Silicon Graphics, Inc.          *
  4.  *                                      *
  5.  *  These coded instructions, statements, and computer programs  contain  *
  6.  *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  7.  *  are protected by Federal copyright law.  They  may  not be disclosed  *
  8.  *  to  third  parties  or copied or duplicated in any form, in whole or  *
  9.  *  in part, without the prior written consent of Silicon Graphics, Inc.  *
  10.  *                                      *
  11.  **************************************************************************/
  12. /*    Copyright (c) 1984 AT&T    */
  13. /*      All Rights Reserved      */
  14.  
  15. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  16. /*    The copyright notice above does not evidence any       */
  17. /*    actual or intended publication of such source code.    */
  18. #ifndef __SYS_SHM_H__
  19. #define __SYS_SHM_H__
  20. #ident    "$Revision: 3.36 $"
  21.  
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #include <standards.h>
  26. #include <sys/ipc.h>
  27.  
  28. /*
  29.  *    IPC Shared Memory Facility.
  30.  */
  31.  
  32. /*
  33. **    Implementation Constants.
  34. */
  35.  
  36. #define    SHMLBA    (256*1024)    /* segment low boundary address multiple */
  37.                 /* (SHMLBA must be a power of 2) */
  38.  
  39. #define    SHMSUS    (32*1024*1024)    /* SPT: segment unit size for SHM_SHATTR */
  40.  
  41. /*
  42. **    Permission Definitions.
  43. */
  44.  
  45. #define    SHM_R    0400    /* read permission */
  46. #define    SHM_W    0200    /* write permission */
  47.  
  48. /*
  49. **    ipc_perm Mode Definitions.
  50. */
  51.  
  52. #define    SHM_INIT    01000    /* grow segment on next attach */
  53.  
  54. /*
  55. **    Message Operation Flags.
  56. */
  57.  
  58. #define    SHM_RDONLY    010000    /* attach read-only (else read-write) */
  59. #define    SHM_RND        020000    /* round attach address to SHMLBA */
  60. #define    SHM_SHATTR    040000    /* try to use shared attributes */
  61.  
  62. typedef ulong_t shmatt_t;
  63.  
  64. /*
  65. **    Structure Definitions.
  66. */
  67.  
  68. /*
  69. **    There is a shared mem id data structure for each segment in the system.
  70. */
  71.  
  72. struct shmid_ds {
  73.     struct ipc_perm    shm_perm;    /* operation permission struct */
  74. #if (_MIPS_SZLONG == 32)
  75.     int        shm_segsz;    /* size of segment in bytes */
  76.     char        *shm_amp;    /* ptr to nothing - MIPSABI */
  77.     short        shm_lkcnt;    /* xxx MIPSABI */
  78.     char        shm_pad[2];    /* for swap compatibility */
  79. #else
  80.     /*
  81.      * for 64 bit, osegsz is filled for binary compat.
  82.      * A new size_t typed field is added to support >4Gb shms
  83.      */
  84.     int        shm_osegsz;    /* size of segment in bytes */
  85.     size_t        shm_segsz;    /* size in bytes (works >4Gb) */
  86.     char        shm_pad[4];    /* compatibility */
  87. #endif
  88.     pid_t        shm_lpid;    /* pid of last shmop */
  89.     pid_t        shm_cpid;    /* pid of creator */
  90.     shmatt_t    shm_nattch;    /* used only for shminfo */
  91.     ulong_t        shm_cnattch;    /* used only for shminfo */
  92.     time_t        shm_atime;    /* last shmat time */
  93.     long        shm_pad1;    /* reserved for time_t expansion */
  94.     time_t        shm_dtime;    /* last shmdt time */
  95.     long        shm_pad2;    /* reserved for time_t expansion */
  96.     time_t        shm_ctime;    /* last change time */
  97.     long        shm_pad3;    /* reserved for time_t expansion */
  98. #if _KERNEL
  99.     struct region    *shm_reg;
  100.     long        shm_pad4[3];    /* reserve area  */
  101. #else
  102.     long        shm_pad4[4];    /* reserve area  */
  103. #endif
  104. };
  105.  
  106. #if defined(_KERNEL) || defined(_KMEMUSER)
  107. struct    shminfo {
  108.     size_t    shmmax;        /* max shared memory segment size */
  109.     size_t    shmmin;        /* min shared memory segment size */
  110.     int    shmmni,        /* size of identifier hash list */
  111.         shmseg;        /* max attached shared memory      */
  112.                 /* segments per process          */
  113. };
  114.  
  115. struct shmstat {
  116.     int        sh_id;
  117.     uint64_t    sh_location;
  118.     struct shmid_ds    sh_shmds;
  119. };
  120. #endif    /* _KMEMUSER */
  121.  
  122. /*
  123.  * Shared memory control operations
  124.  */
  125.  
  126. #define SHM_LOCK    3    /* Lock segment in core */
  127. #define SHM_UNLOCK    4    /* Unlock segment */
  128.  
  129.  
  130. #ifndef _KERNEL
  131.  
  132. extern void    *shmat(int, const void *, int);
  133. extern int    shmdt(const void *);
  134. extern int    shmget(key_t, size_t, int);
  135.  
  136. #if _NO_XOPEN4
  137. extern int     shmctl(int, int, ...);
  138. #else    /* _XOPEN4 */
  139. extern int    shmctl(int, int, struct shmid_ds *);
  140. #endif    /* _NO_XOPEN4 */
  141.  
  142. #endif /* !_KERNEL */
  143.  
  144. #ifdef __cplusplus
  145. }
  146. #endif
  147.  
  148. #endif /* !__SYS_SHM_H__ */
  149.